1. Field of the Invention
The invention relates generally to display drivers and more specifically to the management of a request to a display driver where the display driver determines if the request will be processed by a central processing unit CPU or by a graphic coprocessor.
2. Description of the Related Art
Graphics operations are centered around the concept of a bitmap. A bitmap is a two dimensional rectangular array of pixels. The bitmap can be a rectangular area on the screen or it may be in a portion of memory that is not visible. Each bitmap includes a bitmap header containing a plurality of fields which describes the bitmap in some detail. The bitmap header has a first field which defines where the bitmap is located via a memory bits pointer, a second field which defines the bitmap width as a number of pixels, and a third field which defines the bitmap height as a number of pixels. These three fields of the bitmap header and several other fields (which are not directly relevant here) are always present. Other fields may be added as desired for the private use of the display driver. These additional fields are not interpreted by the system in any way. The system simply passes them around with the rest of the bitmap header.
Graphics operations are performed by the display driver. The display driver receives a call from the system with a request to perform some operation on a bitmap. For example, the display driver may receive a request to copy a portion of one bitmap to another bitmap, or a request is made to set some region within a bitmap to black (all pixels in the region of the bitmap are set the value zero). In a more complicated sort of graphics operation, it is possible that several sources or input bitmaps may be combined in some way and the result written to some destination or output bitmaps. In a case like this, source bitmaps are only read, that is they are not modified in any way, and destination bitmaps may be read and will definitely be written to and modified.
At present, graphic environments generally allow a request to have:
a) only one destination bitmap; PA1 b) no source bitmaps, for example in the case of clearing all the destination bitmap pixels to a single value; PA1 c) one source bitmap as in copying from one bitmap to another; and PA1 d) two source bitmaps to be combined in a variety of ways where the original source bitmaps are read but not altered and the combined bitmap is written to a destination bitmap.
The display driver prefers to use a graphics coprocessor to perform the requested task rather than having the CPU perform the task, since using the graphics coprocessor will, in general, be much faster and will allow both the graphic coprocessor and the CPU to perform operations simultaneously. Where the requested graphic task can be done faster by the CPU or cannot be done by the graphic coprocessor, then the display driver causes the CPU to perform that task. When the system makes a request of the display driver to perform a graphics operation, the display driver looks at the request and makes the determination as to whether the graphics coprocessor or the CPU will handle the request. If the graphics coprocessor can handle the request, then the request is placed at the tail of a graphics coprocessor's queue and the display driver returns to the system indicating that the request has been entered into the queue but not that the request has been executed. The graphics coprocessor continually pulls one request at a time from the head of the queue and executes that request. This is done in order that the requested sequence of reading and/or writing of bitmaps is maintained. When there is no request in the queue, the graphic coprocessor does nothing until a request is placed in the queue.
If the display driver determines that the CPU must handle the request, the display driver cannot immediately start performing the graphics operation on the bitmap requested using the CPU because there may be an operation for that same bitmap in the graphics coprocessor queue (from some prior request) which has not yet executed. If the CPU is allowed to immediately perform the requested graphic operation, then the order of operations for that bitmap may not be maintained and in general the bitmap will not have the correct image in it anymore. The present solution for this problem is whenever the display driver receives a request where it is determined that the operation is to be done with the CPU, the display driver prevents any new request from being stored in the coprocessor's queue and waits until all requests stored in the coprocessor's queue have been completed. The request to be performed by the CPU is then executed by the CPU. This procedure maintains the integrity of the results on the status of the bitmaps that were subject of operations to be performed for requests stored in the graphics coprocessor's queue when a request, determined to be processed by the CPU, is received by the device driver.